/**
 * 
 */
package com.apinoo.users.domain;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author Alejandro Pino Oreamuno
 *
 */
@Entity
@Table(name = "groups")
public class Group implements Serializable {

	public Group() { }
	
	public Group(long idGroup) {
		this.idGroup = idGroup;
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id_group", unique = true, nullable = false)
	private long idGroup;
	
	@Column(name = "name", unique = true, nullable = false)
	private String name;
	
	@Column(name = "authority", unique = true, nullable = false)
	private String authority;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.group")
	private List<UserGroup> listUserGroups = new ArrayList<UserGroup>();
	
	@Column(name = "enabled", nullable = false)
	private boolean enabled;
	
//	@Column(name = "created", nullable = false)
//	private Timestamp created;
//	
//	@Column(name = "modified")
//	private Timestamp modified;
	
//	@Column(name = "created_by", nullable = false)
//	private long createdBy;
//	
//	@Column(name = "modified_by")
//	private long modifiedBy;

	public long getIdGroup() {
		return idGroup;
	}

	public void setIdGroup(long idGroup) {
		this.idGroup = idGroup;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	public List<UserGroup> getListUserGroups() {
		return listUserGroups;
	}

	public void setListUserGroups(
			List<UserGroup> listUserGroups) {
		this.listUserGroups = listUserGroups;
	}

	public boolean getEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}	
	
}
